Manipulating Object Properties of Color Sets and Color Profiles
This section describes how to manipulate the common object properties of color sets and color profiles: owner count and tag list. It also describes how to manipulate the colors of a color set and the profile data of a color profile.For manipulating color sets and color profiles as whole objects, see "Creating and Manipulating Color Set and Color Profile Objects" beginning on page 4-42.
Manipulating Owner Counts
The owner count of an object indicates the number of current references to that object. In general, QuickDraw GX manages owner counts for you. For example, when you create a new color set object, QuickDraw GX sets the owner count of the new color set to 1. If you assign that color profile object to a bitmap structure and then assign that bitmap structure to a bitmap shape, QuickDraw GX increments the color profile's owner count, corresponding to the new reference to the color profile contained in the bitmap structure.In some situations, as when switching color profiles or color sets among objects that reference them, you may want to directly manage their owner counts yourself. To do so, you can
The code fragment on page 4-45 shows an example of an application explicitly managing the owner count of a color profile object.
- use the functions
GXGetColorSetOwners
orGXGetColorProfileOwners
to determine the current owner count- use the functions
GXCloneColorSet
orGXCloneColorProfile
to increment the owner count whenever you create a new reference to the object- use the functions
GXDisposeColorSet
orGXDisposeColorProfile
to decrement the owner count, freeing the memory used by the color set or color profile if the owner count goes to 0
The
GXGetColorSetOwners
function is described on page 4-69. TheGXGetColorProfileOwners
function is described on page 4-84.In the chapter "Style Objects" in this book, the section on manipulating a style object's owner count discusses two common owner-count problems and how to avoid them. The problems are discussed in terms of style objects, but they apply equally well to color sets and color profiles. Refer to that discussion if you find that the color-related objects you create have owner counts that are higher or lower than you expect.
Getting and Setting Tag References
You can examine the list of references to tag objects currently associated with a
color set object or color profile object by using theGXGetColorSetTags
orGXGetColorProfileTags
function. Once you create a tag object, you can attach
it to its object using theGXSetColorSetTags
orGXSetColorProfileTags
function. You can attach as many tag objects as you like to a color set or color profile.Tag objects and the basic functions for manipulating them are described in the chapter "Tag Objects" in this book. That chapter also lists the common tag types defined and reserved by Apple Computer, Inc.
The
GXGetColorSetTags
function is described on page 4-70; theGXGetColorProfileTags
function is described on page 4-85.
TheGXSetColorSetTags
function is described on page 4-71; theGXSetColorProfileTags
function is described on page 4-86.